import React from 'react'
import { getFullSrcs, topNavClick,topNavClick1 } from '@/utils/Helper'
import { CoverImage, CoverView } from '@tarojs/components'


// 顶部nav 的样式（我的市中云）
 export function NavBarTitle (url: string='/pages/my/index') {

  return (
    <CoverView className='navCon'  onClick={()=>topNavClick1(url)}>
      <CoverImage className='navImage' src={getFullSrcs('tab/logo.png')} />
      <CoverView className='navTitle'>我的市中云</CoverView>
    </CoverView>

  )
}

// 顶部nav 的样式（我的市中云）左右箭头都存在
export function NavBarHomeLeft (homeUrl: string='/pages/home/index',leftUrl: string='/pages/home/index') {

  return (
    <CoverView className='homeLeftCon'>
      <CoverImage className='homeImage' src={getFullSrcs('tab/home.png')} onClick={()=>topNavClick(homeUrl)} />
      <CoverImage className='homeImage' src={getFullSrcs('tab/back.png')} onClick={()=>topNavClick(leftUrl)} />
    </CoverView>

  )
}

export function NavBarHomeLeftFormCard(
  homeUrl: string = '/pages/home/index',
  leftUrl: string = '/pages/businesscard-new/index',
  usernamePinyin: string = ''
) {
  // 动态拼接带 username_pinyin 的 URL
  const updatedLeftUrl = `${leftUrl}?username_pinyin=${usernamePinyin}`;

  return (
    <CoverView className='homeLeftCon'>
      <CoverImage
        className='homeImage'
        src={getFullSrcs('tab/home.png')}
        onClick={() => topNavClick(homeUrl)}
      />
      <CoverImage
        className='homeImage'
        src={getFullSrcs('tab/back.png')}
        onClick={() => topNavClick(updatedLeftUrl)}
      />
    </CoverView>
  );
}



// 顶部nav 的样式（我的市中云）
export function NavBarHome (url: string='/pages/home/index') {

  return (
    <CoverImage className='homeImage' src={getFullSrcs('tab/home.png')} onClick={()=>topNavClick(url)} />
  )
}

// 顶部nav 的样式（左侧箭头返回）
export function NavBarLeft (url: string='') {
  return (
    <CoverImage className='backImage' src={getFullSrcs('tab/back_left.png')} onClick={()=>topNavClick(url)} />
  )
}
